package com.ww.springboot.boot.test;

import cn.hutool.http.HttpRequest;
import com.google.common.collect.Lists;
import com.ww.springboot.boot.utils.Func;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.ClassPathResource;

import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2023-07-11 17:23
 */
public class RetryTest4 {

    public static void main(String[] args) throws IOException {
        ClassPathResource classPathResource = new ClassPathResource("/static/text/code.txt");
        String ids = IOUtils.toString(classPathResource.getInputStream(), "utf-8");


        List<String> list = Func.toStrList("\r\n", ids);

        System.out.println(list.size());

        List<List<String>> partition = Lists.partition(list, 500);
        partition.forEach(one->{
            String str = one.stream().collect(Collectors.joining(","));

            System.out.println("http://cpms-service.box-tools.com/test/handSyncSkuPurchaseUserId?" + str);
            String body = HttpRequest.get("http://cpms-service.box-tools.com/test/handSyncSkuPurchaseUserId?" + str).execute().body();
            System.out.println(body);
        });
    }
}
